package com.huadao.cart_ccs.experiment.liquidControl;

import com.huadao.cart_ccs.common.ExperimentStageManager;
import com.huadao.cart_ccs.greendao.GreenDaoManager;
import com.huadao.cart_ccs.greendao.entity.Operation;
import com.huadao.cart_ccs.greendao.gen.OperationDao;

import java.util.List;

public class LiquidControlPresenter extends ILiquidControlContract.ILiquidControlPresenter {

    private OperationDao operationDao;

    public LiquidControlPresenter(ILiquidControlContract.ILiquidControlView baseView) {
        attachView(baseView);
        operationDao=GreenDaoManager.getInstance().getNoCacheSession().getOperationDao();
    }

    @Override
    void getOperatesToday() {
        List<Operation> operationList=operationDao.queryBuilder().where(OperationDao.Properties.Name.eq(baseView.getOperate()),OperationDao.Properties.StageId.eq(ExperimentStageManager.getInstance().getCurrentStage().getId())).list();
        baseView.onGetOperatesToday(operationList);
    }
}
